{include file="public/header" /}

<div class="page">
  <form id="adv_form" enctype="multipart/form-data" method="post" name="advForm">
    <table class="ds-default-table">
      <tbody>
        <tr class="noborder">
          <td class="required w120"><label class="validation" for="name">{$Think.lang.adv_name}:</label></td>
          <td class="vatop rowform"><input type="text" name="name" id="name" class="txt" value="{$adv.adv_title|default=''}"></td>
          <td class="vatop tips">直播间名字，最短3个汉字，最长17个汉字，1个汉字相当于2个字符</td>
        </tr>
        <tr class="noborder">
            <td class="required w120"><label class="validation" for="anchorName">{$Think.lang.anchor_name}:</label></td>
            <td class="vatop rowform"><input type="text" name="anchorName" id="anchorName" class="txt" value="{$adv.anchorName|default=''}"></td>
            <td class="vatop tips">主播昵称，最短2个汉字，最长15个汉字，1个汉字相当于2个字符</td>
        </tr>
        <tr class="noborder">
            <td class="required w120"><label class="validation" for="anchorWechat">{$Think.lang.anchor_wechat}:</label></td>
            <td class="vatop rowform"><input type="text" name="anchorWechat" id="anchorWechat" class="txt" value="{$adv.anchorWechat|default=''}"></td>
            <td class="vatop tips">主播微信号，如果未实名认证，需要先前往“小程序直播”小程序进行实名验证</td>
        </tr>
        <tr class="noborder">
          <td class="required"><label  class="validation" for="startTime">{$Think.lang.adv_start_time}:</label></td>
          <td class="vatop rowform"><input type="text" name="startTime" id="startTime" class="txt date" value="{:date('Y-m-d H:i:s',$adv.startTime)}"></td>
          <td class="vatop tips">直播计划开始时间（开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后）</td>
        </tr>
        <tr class="noborder">
          <td class="required"><label  class="validation" for="endTime">{$Think.lang.adv_end_time}:</label></td>
          <td class="vatop rowform"><input type="text" name="endTime" id="endTime" class="txt date" value="{:date('Y-m-d H:i:s',$adv.endTime)}"></td>
          <td class="vatop tips">直播计划结束时间（开播时间和结束时间间隔不得短于30分钟，不得超过12小时）</td>
        </tr>
        <tr class="noborder" id="adv_code">
            <td class="required"><label  class="validation" for="file_adv_code">{$Think.lang.adv_img_upload}:</label></td>
            <td class="vatop rowform">
                {notempty name="$adv.coverImg_1"}
                <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
                    <div class="type-file-preview"><img src="{$adv.coverImg_1|default=''}"></div>
                </span>
                {/notempty}
                <span class="type-file-box">
                    <input type='text' name='textfield' id='textfield1' class='type-file-text' />
                    <input type='button' name='button' id='button1' value='' class='type-file-button' />
                    <input name="coverImg" id="file_adv_code" type="file" class="type-file-file" id="site_logo" size="30" hidefocus="true">
                </span>
            </td>
          <td class="vatop tips">{$Think.lang.adv_edit_support}gif,jpg,jpeg,png 直播间背景图，图片规则：建议像素1080*1920，大小不超过2M</td>
        </tr>
        <tr class="noborder" id="adv_code_1">
            <td class="required"><label  class="validation" for="file_adv_code_1">{$Think.lang.adv_img_upload_1}:</label></td>
            <td class="vatop rowform">
                {notempty name="$adv.shareImg_1"}
                <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
                    <div class="type-file-preview"><img src="{$adv.shareImg_1|default=''}"></div>
                </span>
                {/notempty}
                <span class="type-file-box">
                    <input type='text' name='textfield' id='textfield2' class='type-file-text' />
                    <input type='button' name='button' id='button1' value='' class='type-file-button' />
                    <input name="shareImg" id="file_adv_code_1" type="file" class="type-file-file" id="site_logo" size="30" hidefocus="true">
                </span>
            </td>
            <td class="vatop tips">{$Think.lang.adv_edit_support}gif,jpg,jpeg,png,直播间分享图，图片规则：建议像素800*640，大小不超过1M；</td>
        </tr>
        <tr class="noborder">
            <td class="required"><label class="validation">{$Think.lang.type}:</label></td>
            <td class="vatop rowform">
                <select name="type" id="type">
                    <option value='0' >手机直播</option>
                    <option value='1' >推流</option>
                </select>
            </td>
            <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
            <td class="required"><label class="validation">{$Think.lang.screen_type}</label></td>
            <td class="vatop rowform">
                <select name="screenType" id="screenType">
                    <option value='1' >横屏</option>
                    <option value='0' >竖屏</option>
                </select>
            </td>
            <td class="vatop tips">横屏：视频宽高比为16:9、4:3、1.85:1 ；竖屏：视频宽高比为9:16、2:3</td>
        </tr>
        <tr class="noborder">
            <td class="required"><label class="validation">{$Think.lang.close_like}</label></td>
            <td class="vatop rowform">
                <select name="closeLike" id="closeLike">
                    <option value='0' >开启</option>
                    <option value='1' >关闭</option>
                </select>
            </td>
            <td class="vatop tips">是否关闭点赞 （若关闭，直播开始后不允许开启）</td>
        </tr>
        <tr class="noborder">
            <td class="required"><label class="validation">{$Think.lang.close_goods}</label></td>
            <td class="vatop rowform">
                <select name="closeGoods" id="closeGoods">
                    <option value='0' >开启</option>
                    <option value='1' >关闭</option>
                </select>
            </td>
            <td class="vatop tips">是否关闭货架 （若关闭，直播开始后不允许开启）</td>
        </tr>
        <tr class="noborder">
            <td class="required"><label class="validation">{$Think.lang.close_comment}</label></td>
            <td class="vatop rowform">
                <select name="closeComment" id="closeComment">
                    <option value='0' >开启</option>
                    <option value='1' >关闭</option>
                </select>
            </td>
            <td class="vatop tips">是否关闭评论 （若关闭，直播开始后不允许开启）</td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>{$Think.lang.ds_submit}</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<link href="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.css" rel="stylesheet" type="text/css">
<script src="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.min.js"></script>
<link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-file-upload/jquery.fileupload.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.ajaxContent.pack.js"></script>
<script type="text/javascript">
$(function(){
    $('#startTime').datetimepicker({dateFormat: 'yy-mm-dd'});
    $('#endTime').datetimepicker({dateFormat: 'yy-mm-dd'});

$("#file_adv_code").change(function () {
            $("#textfield1").val($("#file_adv_code").val());
        });
});
$("#file_adv_code_1").change(function () {
    $("#textfield2").val($("#file_adv_code_1").val());
});
</script>

<script>
//按钮先执行验证再提交表单
$(function () {
    $("#submitBtn").click(function () {
        if ($("#adv_form").valid()) {
            $("#adv_form").submit();
        }
    });
});
//
$(document).ready(function () {

    $('#adv_form').validate({
        errorPlacement: function (error, element) {
            error.appendTo(element.parent().parent().find('td:last'));
        },
        rules: {
            adv_name : {
                required: true
            },
            adv_sort : {
                number:true,
                range:[0,255]
            }
        },
        messages: {
            adv_name : {
                required : '{$Think.lang.adv_can_not_null}'
            },
            adv_sort : {
                number:'{$Think.lang.ds_sort_number}',
                range:'{$Think.lang.ds_range_0_255}'
            }
        }
    });
});
</script>